package com.cn.wanxi.service.impl;

import com.cn.wanxi.dao.CompanyDao;
import com.cn.wanxi.dao.impl.CompanyImpl;
import com.cn.wanxi.model.CompanyModel;
import com.cn.wanxi.model.ResultModel;
import com.cn.wanxi.service.CompanyService;
import com.cn.wanxi.util.ResultData;

/**
 * 逻辑层
 * 调用数据实现层
 */
public class CompanyServiceImpl implements CompanyService {


    @Override
    public ResultModel add(CompanyModel companyModel) {
        CompanyDao companyDao = new CompanyImpl();
        int count = companyDao.add(companyModel);
        ResultModel resultModel = new ResultModel();
        if (count > 0) {
            resultModel.setCode(ResultData.SUCCESS_CODE);
            resultModel.setCount(1);
            resultModel.setMsg(ResultData.SUCCESS_MSG);
            resultModel.setData(count);
        } else {
            resultModel.setCode(ResultData.ERROR_CODE);
            resultModel.setCount(1);
            resultModel.setMsg(ResultData.ERROR_MSG);
            resultModel.setData(count);
        }
        return resultModel;
    }

    @Override
    public ResultModel update(CompanyModel companyModel) {
        return null;
    }

    @Override
    public ResultModel delete(CompanyModel companyModel) {
        return null;
    }

    @Override
    public ResultModel findAll(CompanyModel companyModel) {
        return null;
    }

    @Override
    public ResultModel findById(CompanyModel companyModel) {
        return null;
    }

    @Override
    public ResultModel getCount(CompanyModel companyModel) {
        return null;
    }
}
